import axios from '@/libs/api.request'
// 查询组织-分页
let amount = '/oms/merchant/'
export const getOrgList = (data) => {
  return axios.request({
    url: amount + 'org/page',
    method: 'post',
    data: data
  })
}

// 添加组织
export const saveOrg = (data) => {
  return axios.request({
    url: amount + 'org/create',
    method: 'post',
    data: data
  })
}

// 删除组织
export const delOrg = (data) => {
  return axios.request({
    url: amount + 'org/delete',
    method: 'post',
    data: data
  })
}

// 修改组织
export const updateOrg = (data) => {
  return axios.request({
    url: amount + 'org/update',
    method: 'post',
    data: data
  })
}

// 组织状态-禁用
export const disableOrg = (data) => {
  return axios.request({
    url: amount + 'org/status/disable',
    method: 'post',
    data: data
  })
}

// 组织状态-启用
export const enableOrg = (data) => {
  return axios.request({
    url: amount + 'org/status/enable',
    method: 'post',
    data: data
  })
}

// 查询组织树-指定节点
export const getOrgTree = (data) => {
  return axios.request({
    url: amount + 'org/tree',
    method: 'post',
    data: data
  })
}

// 查询组织树-所有
export const getOrgAllTree = (data) => {
  return axios.request({
    url: amount + 'org/tree/all',
    method: 'post',
    data: data
  })
}

// 查询组织-单独-详情
export const getOrgDetail = (data) => {
  return axios.request({
    url: amount + 'org/info',
    method: 'post',
    data: data
  })
}

// 查询用户-分页
export const getUserList = (data) => {
  return axios.request({
    url: amount + 'user/query',
    method: 'post',
    data: data
  })
}
// 导出组织列表
export const exportOrgList = (data) => {
  return axios.request({
    url: amount + 'org/export',
    // url: 'http://10.101.3.144:8080/oms/merchant/org/export',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

// 验证xls数据
export const veriOrgXls = data => axios.request({
  url: amount + 'org/verify/file',
  method: 'post',
  data,
  headers: {
    'Content-Type': 'multipart/form-data'
  }
})

// 导入xls数据
export const orgXlsImport = data => axios.request({
  url: amount + 'org/import',
  method: 'post',
  data
})

// 查询标签列表
export const getOrgTag = (data) => {
  return axios.request({
    url: '/oms/merchant/tag/list',
    method: 'post',
    data: data
  })
}
